package com.zr.controller.intelligent;

import com.zr.service.intelligent.DijkstraService;
import com.zr.utils.AjaxResult;
import com.zr.vo.intelligent.IntelligentTransferStation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;

/**
 * @author 杜雨萌
 * @date 2022/10/29
 * @version 2022.1
 */
@RestController
@RequestMapping("/intelligent/dijkstra")
public class DijkstraController {

    @Resource
    private DijkstraService dijkstraService;

    /**
     * 获得最短路径
     * @param intelligentTransferStation
     * @return map包含三个对象，分别是最短路径list，中转站list，疫情城市map
     * @throws IOException
     */
    @PostMapping("shortPath")
    public AjaxResult shortPath(@RequestBody IntelligentTransferStation intelligentTransferStation) throws IOException {
        return AjaxResult.success(200,"查询成功",dijkstraService.shortPath(intelligentTransferStation));
    }
}
